Copyright: Written with CreateHelp!


Introduction
RtCheckGroup Component Ver. 1.02

Copyright 1995 Tomasz Stanczak

Compuserve: 100735,3273

I always liked TRadioGroups ability to place the child radiobuttons on the screen by itself. i woukld never do it myself so accurately. This component is something like Borlands TRadioGroup but it groups checkboxes instead of radiobuttons. Same as TRadioGroup it alignes ist child controls itself, so you dont have to do it. You can set them all at once of every one separately. Because it uses bitmaps to show them, you can make it look as you want it to be.

TRtCheckGroup

Registration

Licence

Warranty

Support

Technical Notes

Revision History


TRtCheckGroup

Properties	Methods	Events

TRtCheckGroup is a component very similiar to TRadioGroup but it contains checkboxes instead of radiobuttons. Like TRadioGroup it aligns its child controls itself. The checkboxes are drawn as bitmaps which are defined in properties PictureChecked and PictureUnChecked, so that you are able to change ist look. Besides it conserves resources - it doesnt use real checkboxes which need a window handle. PictureControlColor and PictureWindowColor define transparent colors. Values property lets set checkboxes with values independent from Items - which can be used only to presentation purposes then. Checked (selected) values are stored in Checked property. You can set all of your selection at once with the same property or every selection separately with an array property Value. The CheckMode property decides about which event will cause check status change. Unlike TRadioButton more events have been published, like OnMouse*, OnKey*, etc, it has also OnChange method. The OnCheck event lets you decide if a check status change should take place and the OnDrawItem event lets you draw the items by yourself.


Checked

Declaration

property Checked: TStrings;

Description

This property conraines names or values of all checked items as TStringList objects.


CheckMode

Declaration

property CheckMode: TRtCheckMode;

Description

This property defines in which way a checkbox can be toggled.


PictureChecked

Declaration

property PictureUnChecked: TBitmap;

Description

This property defines the look of an unchecked item.


PictureUnChecked

Declaration

property PictureChecked: TBitmap;

Description

This property defines the look of a checked item.


PictureControlColor

Declaration

property PictureControlColor: TColor;

Description

Because bitmaps dont have transparent colors (or I dont know how to define one in AppStudio) I had to define a color to be transparent. It will be translated into the controls background color before it will be shown. Defaults to clOlive.


PictureWindowColor

Declaration

property PictureWindowColor: TColor;

Description

This is the second transparent color, because to show a 3D checkbox I had to translate ist background into clWindow color. Defaults to clFuchsia


Value

Declaration

property Value[const Value: string]: Boolean;

Description

Through this property you can set the values of every item separately.


Values

Example

Declaration

property Values: TStrings;

Description

This property lets you check items with text values other than those shown in the listbox, in this way you can make presentation (Items property) independent of programm logic.


Example

Items.Clear;

Items.Add(Item1);

Values.Clear;

Values.Add(1);

Value[1] := True;

Value[Item 1] := True; would have also function, but then it would be depentent on what you want to show to the user.


OnChange

Declaration

property Values: TNotifyEvent;

Description

This event will be fired if one or more of the checkboxes change its state, what effectively means that the property Checked will be changed.


OnCheck

Declaration

property OnCheck: TRtCheckEvent;

Description

This event will be fired on checking/unchecking of every item either with the mouse, keyboard or programatically with Value property.


OnDrawItem

Declaration

property OnDrawItem: TRtDrawEvent;

Description

This event happens if a checkbox element should be drawn.


TRtCheckEvent

Unit

RtChkGrp

Declaration

TRtCheckEvent = procedure (Sender: TObject; Index: integer; var Value: Boolean) of object;

Description

This procedure is called by OnCheck event. Parameter Index points the item to be checked/unchecked and Value is the new check status. To changes simply do Value:=not Value;


TRtDrawEvent

Unit

RtChkGrp

Declaration

TRtDrawEvent = procedure (Sender: TObject; Index: integer; DrawRect: TRect; State: TOwnerDrawState;

var Handled: Boolean) of object;

Description

This procedure is called by OnDrawItem event. Parameter Index points to the item to be drawn. DrawRect defines the rectangle where the drawing should take place and State is either an empty set or [odFocused]. In order to supress the default drawing Handled must be set to True.


TRtCheckMode

Declaration

type TRtCheckMode =  (cmNone, cmClick, cmDblClick);

Description

This type defines checkboxes possible behaviour:

cmNone	checkboxes toggle only programatically
cmClick	with a single mouse click and keyboard
cmDblClick	with a double click and keyboard


Registration

Compuserve: GO SWREG

ID# 7193 RtCheckGroup alone, license fee is $10 plus $2.5 s&h

ID# 7197 as part of RtControls, licence fee $35 plus $2.5 s&h

Registered users will receive components full source code. Contact the author for multi-user discounts and site licenses. Shipping only through Compuserve Mail.


Technical Notes

RtCheckGroup doesnt use real checkboxes, it only draws them on the screen, so that the resources are preserved.

The shareware version of this component runs only if Delphi will be found in memory.


Licence

Program and documentation Copyright 1995 Tomasz Stanczak (RiT).  Source code and design time use licensed for a single registered developer. Unlimited royalty-free distribution permitted as part of an EXE file, provided that internal copyright notice is not altered or removed.

Non-registered users may use the software to test it without any time frame, as long as they use the shareware version of RtCheckGroup. A limited license is granted to copy and distribute shareware version of RtCheckGroup only for the trial use of others.


Warranty

LIMITED WARRANTY

EXCEPT AS PROVIDED ABOVE, AUTHOR DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE PRODUCT.  SHOULD THE PROGRAM PROVE DEFECTIVE, THE PURCHASER ASSUMES THE RISK OF PAYING THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION AND ANY INCIDENTAL OR CONSEQUENTIAL DAMAGES.  IN NO EVENT WILL AUTHOR BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION AND THE LIKE) ARISING OUT OF THE USE OR THE INABILITY TO USE THIS PRODUCT EVEN IF AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


Support

Support is available from the author via Compuserve Mail to 100735,3273 (Internet 100735,3273@compuserve.com).  There is no postal, telephone, or fax support. All support is on a "best effort" basis, and no promise is made that all questions can be answered, problems solved, features added nor bugs exterminated.


Revision History

1.00	24.08.95	this is the intial version.

1.01	05.09.95	OnCheck event was added

1.02	12.09.95	error in RtCheckList and RtCheckGroup when checkboxes are not being 	displayed when clWindow=clWhite corrected.

1.03	15.09.95	property CheckMode added

1.04	22.09.95	OnDrawItem event was added


Properties

Align	Font	PopupMenu
Caption	Items	ShowHint
Checked	ParentColor	Sorted
CheckMode	ParentCtl3D	TabOrder
Color	ParentFont	TabStop
Columns	ParentShowHint	Value
Ctl3D	PictureUnChecked	Values
DragCursor	PictureChecked	Visible
DragMode	PictureControlColor
Enabled	PictureWindowColor


Methods

Since TRtCheckGroup inherits from TCustomGroupBox all methods of TWinControl apply.


Events

OnChange	OnEnter
OnCheck	OnExit
OnClick	OnKeyDown
OnDblClick	OnKeyPress
OnDragDrop	OnKeyUp
OnDragOver	OnMouseDown
OnDrawItem	OnMouseMove
OnEndDrag	OnMouseUp